#ifndef _UIBASEIMPL_H_
#define _UIBASEIMPL_H_

#include "stdafx.h"

// {51FA8DE1-216F-4A76-B4F4-B986E9F54C27}
_DEF_CLSID_IMPL(CLSID_IMainViewImpl, 0x51fa8de1, 0x216f, 0x4a76, 0xb4, 0xf4, 0xb9, 0x86, 0xe9, 0xf5, 0x4c, 0x27);

class CMainViewImpl : public IPlugin, public IPluginRun, public IMsgPlugin, public IUIEvent, public CUnknownImp
{
public:
    CMainViewImpl(void);
    virtual ~CMainViewImpl(void);

public:
    BEGIN_STDCOM_MAP
    STDCOM_INTERFACE_ENTRY_UNKNOWN_(IMsgPlugin)
    STDCOM_INTERFACE_ENTRY(IPlugin)
    STDCOM_INTERFACE_ENTRY(IPluginRun)
    STDCOM_INTERFACE_ENTRY(IMsgPlugin)
    STDCOM_INTERFACE_ENTRY(IUIEvent)
    END_STDCOM_MAP

    // IPlugin
    std_method(Init)(IBase* pRot, IBase* pBase);
    std_method(Uninit)();

    // IPluginRun
    std_method(Start)(_pid_t pid, unsigned int type);
    std_method(Stop)(unsigned int exit);

    // IMsgPlugin
    std_method(OnMsgStart)();
    std_method(OnMsgStop)();
    std_method(OnMsgSend)(CLSID sn, CLSID tn, UINT msg, IBase* inmsg, IBase** outmsg);
    std_method(OnMsgRecv)(CLSID sn, CLSID tn, UINT msg, IBase* inmsg, IBase** outmsg);
    std_method_(ULONG, GetRoute)();
    std_method_(ULONG, GetSub)();
    std_method(Set)(ULONG ad);

    // IUiEvent
    std_method(OnUiEvent)(const NotifyEvent* event);

private:
    _lComPtr<IRot> m_pRot;
    _lComPtr<IMainRun> m_pMainRun;
    _lComPtr<IUIBase> m_pIUiBase;
    _lComPtr<IUIWindow> m_pIUiWindow;
    _lComPtr<IUIMessageLoop> m_pIUiMessageLoop;
    _lComPtr<ILogs> m_pILogs;
};

#endif
